package main

import (
	"fmt"
	"path/filepath"
	// "strings"
	// "log"
	"net/http"
	"strings"
)

func requestHandler(w http.ResponseWriter, r *http.Request) {

	fmt.Fprintln(w, "<h1>Hello Web</h1>")

}

func main() {

	// http.HandleFunc("/", requestHandler)

	// err := http.ListenAndServe(":9090", nil)

	// if err != nil {

	// 	log.Fatal("ListenerAndServe :", err)

	// }

	pwd := "/Users/xyhp/Code/hoolay/front/udc/img/v4/org_events/hoolay_horse/*"
	lenpwd := len(pwd)

	files, _ := filepath.Glob(pwd)

	// var Str [cap(files) / 2]string
	type Elem interface{}

	// var myfiles Elem
	// myfiles = files

	// l := cap(myfiles.([]string))

	var Str []string

	for n, val := range files {

		sval := "\"" + val[lenpwd-1:lenpwd+7] + "\""

		// fmt.Println(sval)

		if n%2 == 0 {
			//Str[(n+2)/2-1] = sval
			Str = append(Str, sval)
		}

	}

	fmt.Println("array(" + strings.Join(Str, ",") + ")")

}
